{
 "metadata": {
  "name": "",
  "signature": "sha256:7e577f5daa3b885d4810912b7021260df657f2d0b31e5fccd1519b4bb5de517a"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "The ThinkBayes2 framework\n",
      "-------------------------\n",
      "\n",
      "Allen Downey\n",
      "\n",
      "This notebook describes the ThinkBayes2 module, which I wrote to demonstrate a simple approach to Bayesian statistics.  The [documentation for the module is here](http://www.greenteapress.com/thinkbayes/thinkbayes2.html).\n",
      "\n",
      "My book, [Think Bayes](http://thinkbayes.com), is based on the previous version of this module, thinkbayes.py.  There are only a few changes changes that are not backward-compatible, so if the read the book, you can use this module.\n",
      "\n",
      "thinkbayes2.py and supporting code are in [this GitHub repository](https://github.com/AllenDowney/ThinkBayes2).\n",
      "\n",
      "### Introduction\n",
      "\n",
      "thinkbayes2 is a Python module that provides a framework for Bayesian statistics.  The most important class is `Suite`, which represents a set of hypotheses that are mutually exclusive and collectively exhaustive; in other words, exactly one of the hypotheses is true.  `Suite` provides a method, `Update`, that performs a Bayesian update.\n",
      "\n",
      "`Suite` is based on `Pmf`, which represents a probability mass function.  A Pmf is a map from possible values to their probabilities.  `Pmf` is implemented using a Python dictionary, so the values can be any hashable type.  The probabilities are normally floating-point.\n",
      "\n",
      "This UML diagram shows the relationships among these classes:\n",
      "\n",
      "![UML class diagram](thinkbayes2_yuml.png)\n",
      "\n",
      "`Suite` provides `Update`, which performs a Bayesian update.  It calls `Likelihood`, which is provided by a child class, `Coin` in this example.  It also uses `Normalize`, which is provided by `Pmf`.\n",
      "\n",
      "To use this framework, you normally define a new class that inherits from `Suite`, then provide `Likelihood`.\n",
      "\n",
      "### Example\n",
      "\n",
      "Suppose you are given a strange new coin and you notice that it is unbalanced.  When spun on edge, it seems to land with the \"heads\" side up more often than the \"tails\" side.  You might want to estimate the probability of landing \"heads\" up, which I'll call $x$.\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import print_function, division\n",
      "import thinkbayes2\n",
      "\n",
      "\n",
      "class Coin(thinkbayes2.Suite):\n",
      "    \n",
      "    def Likelihood(self, data, hypo):\n",
      "        x = hypo / 100\n",
      "        if data == 'H':\n",
      "            return x\n",
      "        else:\n",
      "            return 1-x"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 1
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "I'm importing `print_function` and `division` so this code should be compatible with Python 2 and Python 3.\n",
      "\n",
      "The `Likelihood` function computes the likelihood of the data under a given hypothesis.  In this example, `data` is a string, either `\"H\"` or `\"T\"`; `hypo` is the hypothetical value of $x$ in the range 0 to 100.\n",
      "\n",
      "The next step is to instantiate a Coin suite that represents the prior distribution of $x$.  To start simple, I'll use a uniform distribution on the integers from 0 to 100:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "suite = Coin(range(0, 101))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 2
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "`thinkplot` is a module that comes with ThinkBayes2.  It provides wrappers for some of the functions in Matplotlib, and includes functions like `Pdf` that known how to plot `Suites` and other objects from ThinkBayes2."
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import thinkplot\n",
      "thinkplot.Pdf(suite)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "display_data",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEACAYAAABCl1qQAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAELRJREFUeJzt3X+MHOV9x/H34rMpAoTjCNn4BzoEtoorIE6RcdOkbBIg\njhPZSIg4lijEVMISsdKKFAwoheOPqoSqgVoIYjX8uEaNTUQadAiC+ZVVrIYYnARjMGd8Bqs+EwwN\nuG1IJOyy/eN5jl3Gt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W5iVy6eQTqKT3adIf5PsNWAj8DlSn7RjX/Tn13N5/kFS\naLxB+/XFucDPST/mPQz8O+nSdTv2xYBGn4niuXRuXtbQ0RYW20h/hLCT9EO/ldRubk52JdJvVXYC\nd9Qt7yHdxCNPH2Lyu5H0D/000l8PeBr4S9qzL94gXZpdkOcvID0N9DDt1xe9pOvux5E+LxeQPi/t\n2BcDGn0mekifnWmkz9F84Nkx37tR9kXSTaw+0k2advFp0vX550mXX35Neox4BulG72R/LLCR86l9\nYWjXvjiHNLLYTvo2fRLt2xfXUXt0tps0Gm+XvthIulfzHukLxGqGPvYbSefRXuALY7qnkiRJkiRJ\nkiRJkiRJkiRJkiRJkiRNZv8Pzi9772/2+wcAAAAASUVORK5CYII=\n",
       "text": [
        "<matplotlib.figure.Figure at 0x7fb308134090>"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "As expected, the prior is uniform.\n",
      "\n",
      "The next step is to update the prior with data.  Since Update modifies the Suite, I'll make a copy before updating."
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "posterior = suite.Copy()\n",
      "posterior.Update('H')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 4,
       "text": [
        "0.5000000000000003"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "The return value from Update is the normalizing constant, which is the average likelihood of the data across all hypotheses.\n",
      "\n",
      "After the update, large values of $x$ are more likely than small ones, and the hypothesis that $x=0$ has been eliminated."
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "thinkplot.Pdf(posterior)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "display_data",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEACAYAAABcXmojAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgA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3wK6DkutuunY/c3D0NnMM4nlDbByQDZVuEYJzZ\n94773zL+doIOlG3RC/h7jDdNnTB+VqZct06gbIsb8fW133S7+GMonMY42HpNV7yTLhCEYgTCSozd\nR2Ckv+cH/s5Z0Fdjuw/j92QdBT4EHsHYJoG4LU65L1nu62sxwqGAwNsWycBPQBFQDXyMsds5ELfF\nNbX9TFz/etrFXauVP4ZCNsZvXE3A+NDbRGoOMAaCIGAJxtklf/Cob8Q4mIb73/U0f/+I8Q3dA+NT\n838BphKY26IAY7dqH/f1URhn32wi8LZFHsZ+8UiMn5dRGD8vgbgtrqntZ2Ijxs9OGMbPUW/gr43e\nXT2o7UNvgeABjP3nOzF2m+zAOEU30D/wN5KaNweBui2GYEwKuzDeHbcicLfFP1BzSupyjOk6ULbF\nhxjHUuwYbxRmcvOv/R8xXkvzgCcatVMRERERERERERERERERERERERERERERERERERGA/w8zMkim\nxl2KqQAAAABJRU5ErkJggg==\n",
       "text": [
        "<matplotlib.figure.Figure at 0x7fb319554ed0>"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "With additional data we can do a sequence of updates.  The result shows the cumulative effect of all updates."
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "results = 'HTHHTHHHTTHHHTH'\n",
      "for data in results:\n",
      "    posterior.Update(data)\n",
      "    \n",
      "thinkplot.Pdf(posterior)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "display_data",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEACAYAAABcXmojAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xl8VOd97/GPNNqQECAhQEISmwRmB2EMeMGMbRJjbEPa\ntLGdOHadJnbrkOQmuY3j3tsG0nvbJG02X6cujZ3EWWo7cRIXxwvekDeMDGZfBAixCZBAEhJCQtvM\n3D/O0ZkjIWlGSDNnlu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FMx+u9GAU8jzGsez/GaL54vRePYnxG9gD/BaQSP/fi\nZxijNvfYzvX3b38U47u0HPh4mMo4pFwYzU2TgGR678eIZbnAfPN4OEbz2wyMfphvmOcfIb76Yb4G\n/AbYYKbj9V48DXzOPE4CRhKf92ISUIkRCMBYHeF+4udeLAVK6B4U+vq3z8T4Dk3GuG8VROE2zNfS\nfdTSN4nviW0vYMwK7xrVBUbg6GvEVqwpwOh/ugl/TSEe78VIjC/CnuLxXmRj/FjKwgiOLwIfI77u\nxSS6B4W+/u09R4y+ijEgqE+RGDH6mgwXjyZh/CIoYwAT/mLMD4G/A+yz7uLxXkwGzgE/B7YDPwUy\niM97UQ98HzgBnMZYN+114vNedOnr3z4e4zu0S8Dv00gMCj6nCxAhhgO/B74CNPV4rms8cqy7AziL\n0Z/Q1wTJeLkXSRgj+/7d/G8zl9eg4+VeFAH/A+NH03iMz8q9PfLEy73oTaB/e7/3JRKDwimMztYu\nhXSPdPEgGSMg/Aqj+QiM6G+f8HfWgXKF23UY62QdBZ4Bbsa4J/F4L6rMx1Yz/TxGcKgm/u7FQmAz\nUAd0An/AaHaOx3vRpa/PRM/v0wLzXJ8iMShsA6bin/R2F/4OxniQADyFMbrkR7bzGzA60zD/+wKx\n7+8x/qAnY8yafwv4LPF5L6oxmlWnmenlGKNvXiT+7kU5Rrv4MIzPy3KMz0s83osufX0mNmB8dlIw\nPkdTgQ/DXroh0Nekt3hwA0b7+U6MZpMdGEN0433C3zL8Pw7i9V7Mw6gp7ML4dTyS+L0X38A/JPVp\njNp1vNyLZzD6Utoxfig8QP//9r/H+C4tB24Na0lFREREREREREREREREREREREREREREREREREQA\n/j8U0SBt99/eIgAAAABJRU5ErkJggg==\n",
       "text": [
        "<matplotlib.figure.Figure at 0x7fb325f33e50>"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "This distribution shows what what we should believe about $x$ after seeing this data (based on the assumption of a uniform prior).\n",
      "\n",
      "### Implementation\n",
      "\n",
      "ThinkBayes2 is a very simple library.  The `Pmf` class is basically a wrapper for a Python dictionary.  The only substantive method in it is `Normalize`:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "class Pmf(object):\n",
      "\n",
      "    def Normalize(self, fraction=1.0):\n",
      "        \"\"\"Normalizes this PMF so the sum of all probs is fraction.\n",
      "\n",
      "        Args:\n",
      "            fraction: what the total should be after normalization\n",
      "\n",
      "        Returns: the total probability before normalizing\n",
      "        \"\"\"\n",
      "        if self.log:\n",
      "            raise ValueError(\"Normalize: Pmf is under a log transform\")\n",
      "\n",
      "        total = self.Total()\n",
      "        if total == 0.0:\n",
      "            raise ValueError('Normalize: total probability is zero.')\n",
      "            #logging.warning('Normalize: total probability is zero.')\n",
      "            #return total\n",
      "\n",
      "        factor = fraction / total\n",
      "        for x in self.d:\n",
      "            self.d[x] *= factor\n",
      "\n",
      "        return total"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 7
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "And the only substantial method in `Suite` is `Update`:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "class Suite(Pmf):\n",
      "    \"\"\"Represents a suite of hypotheses and their probabilities.\"\"\"\n",
      "\n",
      "    def Update(self, data):\n",
      "        \"\"\"Updates each hypothesis based on the data.\n",
      "\n",
      "        data: any representation of the data\n",
      "\n",
      "        returns: the normalizing constant\n",
      "        \"\"\"\n",
      "        for hypo in self.Values():\n",
      "            like = self.Likelihood(data, hypo)\n",
      "            self.Mult(hypo, like)\n",
      "        return self.Normalize()\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 8
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "As far as the implementation goes, that's all there is to it.  But if you are not sure how or why it works, you should read [Chapter 3](http://www.greenteapress.com/thinkbayes/html/thinkbayes004.html) and [Chapter 4](http://www.greenteapress.com/thinkbayes/html/thinkbayes005.html) of Think Bayes."
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 8
    }
   ],
   "metadata": {}
  }
 ]
}